<script type="text/javascript">
    function search_error2()
    {
        if(document.getElementById("keyword").value == '')
        {
            document.getElementById("error").innerHTML="Bạn chưa nhập nội dung cần tìm";
            return false;
        }
        else
        {
            return true;
        }
    }
</script>
<!--Begin All-->
    <div class="d_all">
    	
		<!--Menu-->
                    <div class="tt_menu_2">
                    	<div class="pl20 pt10">
                            <?php echo $this->ProductCat(); ?>
                         </div>
                            <?php echo $this->render('/search_product.phtml'); ?>
                    </div>
                    
        <!--End Menu-->
    
    <!--Begin Contents-->
    <div class="d_contents_wrap_2">
    	<div class="d_space_height_10"></div>
		
        <!-- Left -->
        <div class="dd_ctsp">
        
        <div class="ttct_top">
            <div class="pl20">Tìm kiếm Voucher</div>
        </div>
        
        <div class="dd_ctsp_mid">
            <div class="pa20">
                <div class="search_product">
                    <form action="" method="get" onsubmit="return search_error2()">
                        <table>
                            <tr style="height: 50px;">
                                <td width="140px"><?php echo $this->formLabel('keyword', 'Nội dung tìm kiếm:'); ?></td>
                                <td><?php echo $this->formText('keyword', $this->searchValue, array('id' => 'keyword', 'class' => 'input', 'style' => 'width: 360px')); ?></td>
                                <td><?php echo $this->formSubmit('submit', 'Tìm kiếm', array('class' => 'button')); ?></td>
                            </tr>
                            <tr style="height: 50px;">
                                <td><?php echo $this->formLabel('category', 'Danh mục:'); ?></td>
                                <td colspan="2">
                                    <select name="cat_id" class="input" id="category" style="width: 200px;">
                                    <option value="0">Tất cả</option>
                                    <?php foreach($this->cat_id as $cat_id) : ?>
                                    <option value="<?php echo $cat_id['cat_id']; ?>"><?php echo $cat_id['cat_name']; ?></option>
                                    <?php endforeach; ?>
                                    </select>
                                </td>
                            </tr>
                            <tr style="height: 50px;">
                                <td><?php echo $this->formLabel('area', 'Tỉnh thành phố:'); ?></td>
                                <td colspan="2">
                                    <select name="area_id" class="input" id="area" style="width: 200px;">
                                    <option value="0">Toàn quốc</option>
                                    <?php foreach($this->area_id as $area_id) : ?>
                                    <option value="<?php echo $area_id['area_id']; ?>"><?php echo $area_id['area_name']; ?></option>
                                    <?php endforeach; ?>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>&nbsp;</td>
                                <td><div id="error" class="msg"><?php echo $this->error; ?></div></td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
        </div>
        
        <!-- End Kênh tin -->
        <div class="dd_ctsp_bot"></div>	
        
        <div class="ttct_top">
            <div class="pl20">Kết quả tìm kiếm</div>
        </div>
        
        <div class="dd_ctsp_mid">
            <div class="pa20">
                <div class="search_product">
                    <div class="total">
                        Tìm thấy <span class="msg"><?php echo $this->total; ?></span> kết quả.
                    </div>
                    
                    <?php
                        if(count($this->data > 0)) :
                        foreach($this->data as $value) :
                    ?>
                    <div class="records_list">
                        <div class="records_title">
                            <?php echo $value['sort_name']; ?>
                        </div>
                        
                        <img class="records_image" src="<?php echo $this->baseUrl('/public/files/product/') . $value['product_image']; ?>" />
                        
                        <div class="records_content">
                            <?php echo $value['content_plaintext']; ?>
                        </div>
                        
                        <div class="record_area">
                            <?php echo $value['area_name']; ?>
                        </div>
                    </div>
                    <?php endforeach; ?>
                    
                    <div class="pagination">
                        <?php 
                            $currentUrl = '?keyword=' . $this->searchValue . '&cat_id=' . $value['cat_id'] . '&area_id=' . $value['area_id'];
                            echo $this->paginationControl($this->data, 'Sliding', 'search/pagination.phtml', array('currentUrl' => $currentUrl)); 
                        ?>
                    </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
        
        <!-- End Kênh tin -->
        <div class="dd_ctsp_bot"></div>	

        </div>
        <!-- End Left -->    